package com.honeybee.cloud.framework.base.exception.authorize;

import com.honeybee.cloud.framework.base.exception.business.BaseBizException;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description 授权异常
 * @Author DELL
 * @Create 2018-12-08
 * @Since 1.0.0
 */
@Slf4j
public class NoAuthorizeExceptionBase extends BaseBizException {

    public NoAuthorizeExceptionBase(Integer parentCode, Integer subCode, String message) {
        super(String.format(message, parentCode, subCode));
        this.parentCode = parentCode;
        this.subCode = subCode;
        this.msg = message;
    }

    public static NoAuthorizeExceptionBase getInstance(NoAuthorizeExceptionEnum exceptionEnum) {
        return new NoAuthorizeExceptionBase(exceptionEnum.getParentCode(), exceptionEnum.getSubCode(), exceptionEnum.getParentMessage());
    }
}
